package web.directories.action;

import com.opensymphony.xwork2.ActionSupport;
import domain.entities.Compromisopais;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.ResultPath;
import org.springframework.beans.factory.annotation.Autowired;
import services.ProtocoloCompromisopaisService;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Guillermo
 * Date: 22/08/12
 * Time: 15:08
 * To change this template use File | Settings | File Templates.
 */
@ResultPath("/")
public class ProtocoloCompromisoPaisController   extends ActionSupport {

    private ProtocoloCompromisopaisService protocoloCompromisopaisService;
    private List<Compromisopais> compromisopaises = new ArrayList<Compromisopais>();
    private String compromisopaisesId;
    private String protocoloid;

    @Autowired
    public ProtocoloCompromisoPaisController(ProtocoloCompromisopaisService protocoloCompromisopaisService) {
        this.protocoloCompromisopaisService = protocoloCompromisopaisService;
    }

    @Action(value="getPaisByProtocolo", results={@Result(name="success",location="WEB-INF/jsp/Directories/centralVendor/compromisopais.jsp")})
    public String execute() {
        compromisopaises = protocoloCompromisopaisService.findCompromisoPaisByProtocoloId(this.protocoloid);
        return SUCCESS;
    }

    public List<Compromisopais> getCompromisopaises() {
        return compromisopaises;
    }

    public void setCompromisopaises(List<Compromisopais> compromisopaises) {
        this.compromisopaises = compromisopaises;
    }

    public String getCompromisopaisesId() {
        return compromisopaisesId;
    }

    public void setCompromisopaisesId(String compromisopaisesId) {
        this.compromisopaisesId = compromisopaisesId;
    }

    public String getProtocoloid() {
        return protocoloid;
    }

    public void setProtocoloid(String protocoloid) {
        this.protocoloid = protocoloid;
    }
}
